#!coding=utf-8
from django.db import models

class MapDataCategory(models.Model):
    name = models.CharField(u'地图数据类型',max_length = 50)
    key = models.CharField(u'类型关键字',max_length = 50)

    def getObj(self):
        _dict = {}
        _dict['id'] = int(self.id)
        _dict['name'] = self.name
        _dict['key'] = self.key

        return _dict

class MapData(models.Model):
    enterprise_id = models.CharField(u'企业',max_length = 20,default = '')
    center_point = models.TextField(u'中心点',default = '' )
    points = models.TextField(u'点集',default = '' )
    mapData_type = models.ForeignKey(MapDataCategory)     #地图种类

    def getObj(self):
        _dict = {}
        _dict['id'] = int(self.id)
        _dict['points'] = self.points 
        _dict['center_point'] = self.center_point 
        _dict['mapData_type'] = self.mapData_type.getObj()
        return _dict